import Cookies from 'js-cookie'

const TokenKey = 'trunkToken'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}
export function getUser () {
  return JSON.parse(localStorage.getItem('UserInfo'))
}

export function setUser (user) {
  return localStorage.setItem('UserInfo', JSON.stringify(user))
}
export function removeUser () {
  return localStorage.removeItem('UserInfo')
}
export function removeToken() {
  return Cookies.remove(TokenKey)
}
